package com.briup.recognition.service.impl;

import com.briup.recognition.bean.BasePrivilege;
import com.briup.recognition.bean.BasePrivilegeExample;
import com.briup.recognition.dao.BasePrivilegeMapper;
import com.briup.recognition.service.IBasePrivilegeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BasePrivilegeServiceImpl implements IBasePrivilegeService {
    @Resource
    private BasePrivilegeMapper basePrivilegeMapper;

    @Override
    public List<BasePrivilege> query(){
        BasePrivilegeExample example = new BasePrivilegeExample();
        return basePrivilegeMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate(BasePrivilege basePrivilege){
        if (basePrivilege.getId()!=null){
            basePrivilegeMapper.updateByPrimaryKey(basePrivilege);
        }else {
            basePrivilegeMapper.insert(basePrivilege);
        }
    }

    @Override
    public void deleteById(long id) {
        basePrivilegeMapper.deleteByPrimaryKey(id);
    }

}
